<template>
  <div class="info-redis-root info-root">
    <div class="info-title">
      Redis 信息
    </div>
    <div class="info-content">
      <el-descriptions class="qa-gw-desc" :column="2">
        <el-descriptions-item label="模式:">
          <el-tag type="info">{{ redisInfo.redis_mode }} ({{ redisInfo.tcp_port }})</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="节点角色:">
          <el-tag type="info">{{ redisInfo.role }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="版本:">
          <el-tag type="info">{{ redisInfo.redis_version }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="运行时间:">
          <el-tag type="info">{{ redisInfo.uptime_in_days }} 天 ({{ redisInfo.uptime_in_seconds }} 秒)</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="客户端数量:">
          <el-tag type="info">{{ redisInfo.connected_clients }}</el-tag>
        </el-descriptions-item>
      </el-descriptions>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const redisInfo = ref({
  redis_mode: "",
  tcp_port: "",
  redis_version: "",
  role: "",
  uptime_in_days: "",
  uptime_in_seconds: "",
  connected_clients: "",
})

const initMap = (info: any) => {
  redisInfo.value = info;
}

defineExpose({
  initMap
})
</script>

<style scoped lang="scss">
.info-redis-root {
  @include box(100%, 100%);

  .info-title {
    @include themeColor(#AE564C, #aa4d45)
  }
}
</style>